<?php 
$resume = new Default_Model_ExperienceMapper();
$listFunction = $resume->getFunction();
?>
<div id="adv-search" class="content">
<div align="center" style="color:#1B7CBD;font-size:16px"><b>RESUME DETAIL</b></div>
<br />
<h2>
    Personal Details
    <a href="/resume/personal-info/id/<?php echo $this->resume->getResumeId()?>"><img src="/images/edit.png" width="14px" height="14px" alt="Edit" /></a>
</h2>
<table cellpadding="5" cellspacing="6">
	<tr>
		<td style="width:115px">Candidate Name</td>
		<td><b><?php echo $this->resume->getFullName();?></b></td>
	</tr>
	<tr>
		<td>Birthday</td>
		<td><?php echo $this->resume->getBirthday();?></td>
	</tr>                    
	<tr>
		<td>Gender</td>
		<td><?php echo $this->resume->getGender();?></td>
	</tr>
	<tr>
		<td>Marital Status</td>
		<td><?php echo $this->resume->getMaritalStatus();?></td>
	</tr>
	<tr>
		<td>Address</td>
		<td><?php echo $this->resume->getAddress();?></td>
	</tr>
	<tr>
		<td>Email</td>
		<td><?php echo $this->resume->getEmail1();?></td>
	</tr>
	<tr>
		<td>Phone</td>
		<td><?php echo $this->resume->getMobile1();?></td>
	</tr>
</table>
<?php 
$educationMapper = new Default_Model_EducationMapper();
$educationList = $educationMapper->fetchAll('resume_id = ' . $this->resume->getResumeId(), 'end_date DESC');
?>
<h2>
    EDUCATION
    <a href="/resume/education/id/<?php echo $this->resume->getResumeId()?>"><img src="/images/edit.png" width="14px" height="14px" alt="Edit" /></a>
</h2>
<?php if($educationList):?>
<table cellpadding="5" cellspacing="6"> 
    
    <?php foreach ( $educationList as $education ) :
        //$date = new DateTime($education->getStartDate());
        //$startDate = $date->format('M Y');

        //$date = new DateTime($education->getEndDate());
        //$endDate = $date->format('M Y');
    ?>
    <tr>
        <td style="width:30%" valign="top"><?php echo $education->getStartDate()?> <?php echo ($education->getEndDate())? ' - ' . $education->getEndDate():'';?></td>
        <td class="companies" style="width:65%">
            <p style="color:#70b4e2;font-weight:bold;text-transform: uppercase;"><?php echo $education->getSchoolName();?></p>
            <p><?php echo $education->getProgramName();?></p>
        </td>
    </tr>
    <?php endforeach;?> 
</table>
<?php else:?>
<br />
<?php endif;?>
<?php 
$experienceMapper = new Default_Model_ExperienceMapper();
$experienceList = $experienceMapper->fetchAll('resume_id = ' . $this->resume->getResumeId(), 'end_date DESC');

$resumeMapper = new Default_Model_ResumeMapper();
$comment = $resumeMapper->getComments($this->resume->getResumeId(), 1);
$date = new DateTime($comment['created_date']);
$createdComment = $date->format('M-d');
?>
<h2>
    CAREER SUMMARY
    <a href="/resume/experience/id/<?php echo $this->resume->getResumeId()?>"><img src="/images/edit.png" width="14px" height="14px" alt="Edit" /></a>
</h2>
<?php if($experienceList):?>
<table cellpadding="5" cellspacing="6">
	<?php foreach ( $experienceList as $experience ) :
		//$date = new DateTime($experience->getStartDate());
		//$startDate = $date->format('M Y');

		//$date = new DateTime($experience->getEndDate());
		//$endDate = $date->format('M Y');
	?>
	<tr>
		<td style="width:30%" valign="top"><?php echo $experience->getStartDate();?><?php echo ($experience->getEndDate())? ' - ' . $experience->getEndDate():'&nbsp;';?></td>
		<td class="companies" style="width:65%">
            <?php if($experience->getExperienceOther()) :?>
                <p style="color:#70b4e2;font-weight:bold;text-transform: uppercase;">Experience Other</p>
            <?php else:?>
			<p style="color:#70b4e2;font-weight:bold;text-transform: uppercase;"><?php echo $experience->getCompanyName();?></p>
			<p><?php echo $experience->getJobTitle();?></p>
            <p><b>Duties: </b><br /><?php echo $experience->getDuties();?></p>
            <?php endif;?>
		</td>
	</tr>
	<?php endforeach;?>                  
</table>
<?php else :?>
<br />
<?php endif;?>
<h2>
    EXPECTION
    <a href="/resume/expectation/id/<?php echo $this->resume->getResumeId()?>"><img src="/images/edit.png" width="14px" height="14px" alt="Edit" /></a>
</h2>
<?php 
$expectationMapper = new Default_Model_ExpectationMapper();
$expectation = $expectationMapper->getExpectation($this->resume->getResumeId());

$provinceArr = array();
if($expectation['res_expectation_id']) {
	$resumeProvince = $expectationMapper->getExpectationProvince($expectation['res_expectation_id']);
	foreach($resumeProvince as $province){
		$provinceArr[] = $province['name'];
	}
}

$currentSalary = number_format($expectation['current_salary']);
@$salaryFrom = number_format($expectation['estimated_salary_from']);
@$salaryTo = number_format($expectation['estimated_salary_to']);
?>
Salary: <?php if($currentSalary) echo '$'.$currentSalary; ?><br />
Estimated: <?php if($salaryFrom) echo '$'.$salaryFrom; ?><?php if($salaryTo) echo ' - '.'$'.$salaryTo; ?><br />
Location: <?php echo implode(', ', $provinceArr);?>
<div class="actions">
	<a href="/resume/export-to-word/id/<?php echo $this->resume->getResumeId();?>" style="text-decoration:none;"><input type="button" class="button01" name="export" value="Export to Word"></a>&nbsp;&nbsp;&nbsp;
	<a href="/resume/personal-info/id/<?php echo $this->resume->getResumeId();?>" style="text-decoration:none;"><input type="button" class="button01" name="edit" value="Edit"></a>&nbsp;&nbsp;&nbsp;
	<input type="button" class="button02" name="cancel" value="Cancel" onclick="$.fancybox.close();"/>
</div>
</div>
